﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using YJKRevitKernel.ElementSearchUtility.LinkDocumentSuite;
using YJKGeometryFuncs;
using YJKPatternSign.StairsRoomSection.Kit;

namespace YJKPatternSign.StairsRoomSection.SignElems
{
	public class RailingComparison
	{
		public int Compare(BaseLinkDocumentResultBean x, BaseLinkDocumentResultBean y)
		{
			if (x == null)
			{
				if (y == null)
				{
					return 0;
				}
				return -1;
			}
			else
			{
				if (y == null)
				{
					return 1;
				}
				List<Curve> curves = (x.UseElement as Railing).GetPath() as List<Curve>;
				Transform totalTransform = x.GetTotalTransform();
				double z = CommonFun.TranCurve(curves, totalTransform)[0].GetEndPoint(0).Z;
				List<Curve> curves2 = (y.UseElement as Railing).GetPath() as List<Curve>;
				x.GetTotalTransform();
				double z2 = CommonFun.TranCurve(curves2, totalTransform)[0].GetEndPoint(0).Z;
				if (Geometry.LessThan(z, z2))
				{
					return -1;
				}
				return 1;
			}
		}
	}
}
